package com.weixinli.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.weixinli.beans.FmArticle;
import com.weixinli.beans.PageInfo;
import com.weixinli.dao.IFmArticleDao;
import com.weixinli.utils.PageUtil;

@Repository("iFmArticleDao")
public class FmArticleDaoImpl implements IFmArticleDao {
	private SqlSession sqlSession;
	public int addFmArticle(FmArticle fm) {
		return sqlSession.insert("addFmArticle", fm);
	}
	@Resource(name="sqlSession")
	public void setSqlSession(SqlSession sqlSession) {
		this.sqlSession = sqlSession;
	}
	
	public FmArticle selectFid(FmArticle fm) {
		return sqlSession.selectOne("selectFid",fm);
	}
	public int insertAduio(FmArticle fm) {
		return sqlSession.insert("insertAduio",fm);
	}
	public List<FmArticle> findAll(PageInfo pageInfo) {
		return sqlSession.selectList("findBackFMAll",pageInfo);
	}
	public int delFmArticle(FmArticle fm) {
		return sqlSession.delete("delFmArticle",fm);
	}
	public FmArticle getDatesArticle() {
		return sqlSession.selectOne("getDatesArticle");
	}
	public List<FmArticle> Newest() {
		return sqlSession.selectList("Newest");
	}
	public FmArticle change(FmArticle fm) {
		return sqlSession.selectOne("change",fm);
	}
	public List<FmArticle> typeArticle(FmArticle fm) {
		return sqlSession.selectList("typeArticle",fm);
	}
	public List<FmArticle> findArticle(String searchContent) {
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("fname",searchContent);
		return sqlSession.selectList("findArticleSearch",map);
	}
	public List<FmArticle> findArticleIndex() {
		return sqlSession.selectList("findIndexData");
	}	
}
